<?php
/**
 * Created by PhpStorm.
 * User: stc17
 * Date: 2020/3/4
 * Time: 11:12
 */

namespace SwoStar\Server\WebSocket;

/*管理连接对象
 * */
class Connections
{
    /*
     * 记录用户的连接
     * [
     *      fd=>[
     *             'path'=>xxx,
     *              'xxx'=>000
     *      ]
     * ]
     * */
    protected static $connections=[];

    public static function init($fd,$request)
    {
        self::$connections[$fd]['path']=$request->server['path_info'];
        self::$connections[$fd]['request']=$request;
    }
    public static function get($fd){
        return self::$connections[$fd];
    }

    public static function del($fd)
    {
        unset( self::$connections[$fd]);
    }
}